<!-- 左边图标跳转 页面 -->
<template>
	<view class="">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
			<view class="evaluate margin-top_10rpx " v-for="(item,index) in evaluateList" :key="index">


				<view class="flex-between margin-top_10rpx">
					<view class="flex-start-center">
						<image class="imgIcon margin-right_16rpx" :src="item.avatar" mode=""></image>
						<view class="flex-columns">
							<view class="font-weight_bold" style="font-size: 28rpx;">
								{{item.nickname}}
							</view>
							<view class="" style="color: #666666;font-size: 22rpx;margin-top: 10rpx;">
								{{item.create_time}}
							</view>
						</view>
					</view>
					<view class="flex-align-center">
						<uni-rate :readonly="true" :value="item.grade" :max="5" size="18" activeColor="#FF5F4E"
							margin="5" />
						<view class="v-star-score">{{ Number(item.grade).toFixed(1) }}</view>
					</view>
				</view>
				<view class="margin-top_30rpx ">
					<text style="color: #666666;width: 648rpx;" class="font-size_26rpx font-overflow2">
						{{item.content}}
					</text>
				</view>
				<view class="flex-start-center-wrap  ">
					<view v-for="(img,indexs) in item.pic_url" :key="indexs">
						<image style="width: 144rpx; height: 144rpx;margin-top: 30rpx;padding: 6rpx;" :src="img"
							@click.stop="imgScare(item.pic_url,2,indexs)" mode="aspectFill">
						</image>
					</view>
				</view>


			</view>
		</mescroll-body>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				evaluateList: [

				],
				goods_id: ''
			};
		},
		onLoad(options) {
			this.goods_id = options.goods_id
		},


		methods: {
			async upCallback(scroll) {

				const result = await this.$http.get({
					url: this.$api.evaluateList,
					data: {
						page: scroll.num,
						psize: 10,
						goods_id: this.goods_id,
						// uid: uni.getStorageSync('uid')


					}
				});
				if (result.errno == 0) {
					this.mescroll.endByPage(result.data.list.length, result.totalPage);
					if (scroll.num == 1) this.evaluateList = [];
					this.evaluateList = this.evaluateList.concat(result.data.list);
					// if (this.distributionSet.distribution_level != 0) {
					// 	this.getChange2(0);
					// }
				}
			},
			imgScare(img, len, index) {
				console.log(img)

				if (len == 1) {
					uni.previewImage({
						urls: [img],
						longPressActions: {
							itemList: ['发送给朋友', '保存图片', '收藏'],
							success: function(data) {

							},
							fail: function(err) {

							}
						}
					});
				} else {
					uni.previewImage({
						urls: img,
						current: index,
						longPressActions: {
							itemList: ['发送给朋友', '保存图片', '收藏'],
							success: function(data) {

							},
							fail: function(err) {

							}
						}
					});
				}


			},

		}
	};
</script>

<style lang="less">
	.evaluate {
		margin: 22rpx 22rpx;
		// height: 266rpx;
		border-radius: 20rpx;
		padding: 20rpx;
		background: rgb(255, 255, 255);

		.imgIcon {
			width: 92rpx;
			height: 92rpx;
			border-radius: 50%;
		}
	}
	
	.v-star-score {
		margin-left: 4rpx;
		margin-top: 4rpx;
		color: #ff5f4e;
		font-weight: bold;
	}
</style>